import './AppBar.css';

const WEBSITE_URL = 'erciyuan000.jw238.site';

const AppBar = () => {
  const handleCopyWebsite = () => {
    navigator.clipboard.writeText(WEBSITE_URL).then(() => {
      alert('网站链接已复制到剪贴板！');
    }).catch(() => {
      alert('复制失败，请手动复制：' + WEBSITE_URL);
    });
  };

  return (
    <header className="app-bar">
      <div className="app-bar-content">
        <h1>二次元古玩店</h1>
        <div className="app-bar-right">
          <nav>
            <ul>
              <li><a href="#home">首页</a></li>
              <li><a href="#products">商品</a></li>
              <li><a onClick={handleCopyWebsite}>分享</a></li>
            </ul>
          </nav>
          <button className="copy-button" onClick={handleCopyWebsite}>
            复制网站
          </button>
        </div>
      </div>
    </header>
  );
};

export default AppBar; 